package cn.mybatisplus;

import cn.mybatisplus.entity.User;
import cn.mybatisplus.service.UserService;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.ArrayList;

@SpringBootTest
public class MyBatisPlusServiceTest_ {

    @Autowired
    private UserService userService;

    @Test
    public void testSelectcount(){

        long count = userService.count();
        System.out.println(count);

    }

    @Test
    public void testInsertService(){
        ArrayList<User> users = new ArrayList<>();
        for (int i = 1;i <= 10;i++){
            User user = new User();
            user.setAge(23);
            user.setName("haha" + i);
            user.setEmail("haha@qq.com" + i);
            users.add(user);
        }
        boolean b = userService.saveBatch(users);
        System.out.println(b);
    }
}
